<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<div id="app">
			<!-- 
        v-memo: 该指令接受一个固定长度的数组作为依赖值进行记忆比对,
          如果数组中的每个值和上一次渲染的时候相同, 则整个该字数的更新会被跳过
       -->
			<div v-memo="[name]">
				<h2>姓名: {{name}}</h2>
				<h2>年龄: {{age}}</h2>
				<h2>身高: {{height}}</h2>
			</div>

			<button @click="updateInfo">修改</button>
		</div>

		<script src="./js/vue.js"></script>
		<script>
			// 1. 创建app实例
			const app = Vue.createApp({
				data() {
					return {
						name: 'why',
						age: 18,
						height: 1.88,
					}
				},
				methods: {
					updateInfo() {
						// this.name = 'kobe'
						this.age = 20
					},
				},
			})

			// 2. 挂载到#app上
			app.mount('#app')
		</script>
	</body>
</html>
